/** * @license * Copyright 2019 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from "@angular/core"; import { ApiDefinition } from "../../../../models/api.model"; import { AaiChannelItem, AaiDocument, CombinedVisitorAdapter, ICommand, IValidationSeverityRegistry, Node, Aai20SchemaDefinition, AaiOperationTraitDefinition, AaiMessageTraitDefinition, OtCommand, OtEngine, ValidationProblem, AaiMessage } from "apicurio-data-models"; import { AsyncApiEditorMasterComponent } from "./_components/aaimaster.component"; import { VersionedAck } from "../../../../models/ack.model"; import { ApiEditorUser } from "../../../../models/editor-user.model"; import { SelectionService } from "./_services/selection.service"; import { CommandService } from "./_services/command.service"; import { DocumentService } from "./_services/document.service"; import { EditorsService, IEditorsProvider } from "./_services/editors.service"; import { ServerEditorComponent } from "./_components/editors/server-editor.component"; import { SecuritySchemeEditorComponent } from "./_components/editors/security-scheme-editor.component"; import { SecurityRequirementEditorComponent } from "./_components/editors/security-requirement-editor.component"; import { DataTypeEditorComponent } from "./_components/editors/data-type-editor.component"; import { ParameterEditorComponent } from "./_components/editors/parameter-editor.component"; import { PropertyEditorComponent } from "./_components/editors/property-editor.component"; import { ResponseEditorComponent } from "./_components/editors/response-editor.component"; import { OperationTraitEditorComponent } from "./_components/editors/operationtrait-editor.component"; import { MessageTraitEditorComponent } from "./_components/editors/messagetrait-editor.component"; import { ApiEditorComponentFeatures } from "./_models/features.model"; import { FeaturesService } from "./_services/features.service"; import { CollaboratorService } from "./_services/collaborator.service"; import { ApiCatalogService } from "./_services/api-catalog.service"; import { AbstractApiEditorComponent } from "./editor.base"; import { ComponentType } from "./_models/component-type.model"; import { ImportedComponent } from "./_models/imported-component.model"; import { CodeEditorMode, CodeEditorTheme } from "../../../../components/common/code-editor.component"; import { AaiServerEditorComponent } from "./_components/editors/aaiserver-editor.component"; import { MessageEditorComponent } from "./_components/editors/message-editor.component"; import { OneOfInMessageEditorComponent } from "./_components/editors/oneof-in-message-editor.component"; export declare class AsyncApiEditorComponent extends AbstractApiEditorComponent implements OnChanges, OnInit, OnDestroy, IEditorsProvider { private selectionService; private commandService; private documentService; private editorsService; private featuresService; private collaboratorService; private catalog; api: ApiDefinition; embedded: boolean; features: ApiEditorComponentFeatures; validationRegistry: IValidationSeverityRegistry; contentFetcher: (externalReference: string) => Promise; componentImporter: (componentType: ComponentType) => Promise; onCommandExecuted: EventEmitter; onSelectionChanged: EventEmitter; onValidationChanged: EventEmitter; onUndo: EventEmitter; onRedo: EventEmitter; onConfigureValidation: EventEmitter; private _document; private _otEngine; _undoableCommandCount: number; _redoableCommandCount: number; theme: string; sourceOriginal: string; sourceValue: string; sourceIsValid: boolean; private currentSelection; private currentSelectionType; private currentSelectionNode; validationErrors: ValidationProblem[]; private _selectionSubscription; private _commandSubscription; private _catalogSubscription; master: AsyncApiEditorMasterComponent; aaiServerEditor: AaiServerEditorComponent; securitySchemeEditor: SecuritySchemeEditorComponent; securityRequirementEditor: SecurityRequirementEditorComponent; dataTypeEditor: DataTypeEditorComponent; operationTraitEditor: OperationTraitEditorComponent; messageTraitEditor: MessageTraitEditorComponent; messageEditor: MessageEditorComponent; oneOfInMessageEditor: OneOfInMessageEditorComponent; propertyEditor: PropertyEditorComponent; formType: string; /** * Constructor. * @param selectionService * @param commandService * @param documentService * @param editorsService * @param featuresService * @param collaboratorService */ constructor(selectionService: SelectionService, commandService: CommandService, documentService: DocumentService, editorsService: EditorsService, featuresService: FeaturesService, collaboratorService: CollaboratorService, catalog: ApiCatalogService); /** * Called when the editor is initialized by angular. */ ngOnInit(): void; /** * Called when angular destroys the editor component. */ ngOnDestroy(): void; /** * Called when the @Input changes. * @param changes */ ngOnChanges(changes: SimpleChanges): void; sourceTheme(): CodeEditorTheme; sourceMode(): CodeEditorMode; isDirty(): boolean; /** * Gets the spec as a document. */ document(): AaiDocument; /** * Lazy getter for the OtEngine. */ otEngine(): OtEngine; /** * Called whenever the user presses a key. * @param event */ onGlobalKeyDown(event: KeyboardEvent): void; /** * Called when the user clicks the Undo button or uses the Ctrl-z hotkey. */ undoLastCommand(): void; /** * Called when the user clicks the Redo button or uses the Ctrl-y hotkey. */ redoLastCommand(): void; /** * Called when an editor component creates a command that should be executed. * @param command */ protected onCommand(command: ICommand): void; /** * Executes a command. Called by the parent of this component when detecting that * another user has executed a command. In other words, this command is *not* * performed by the local user. * @param command */ executeCommand(command: OtCommand): void; /** * Call this to undo a command. Typically this is used to undo commands from * remote collaborators after receiving an async message from the server. * @param command */ undoCommand(command: OtCommand | number | string): void; /** * Call this to redo a command. Typically this is used to undo commands from * remote collaborators after receiving an async message from the server. * @param command */ redoCommand(command: OtCommand | number): void; /** * Finalizes a command. * @param ack */ finalizeCommand(ack: VersionedAck): void; /** * Called to update the selection state of the given remote API editor (i.e. an active collaborator). * @param user * @param selection */ updateCollaboratorSelection(user: ApiEditorUser, selection: string): void; /** * Called when the user selects a node in some way. * @param path */ onNodeSelected(path: string): void; /** * Called to update which form is displayed (the details view). * @param path */ private updateFormDisplay; /** * Called to validate the model. */ validateModel(): void; /** * Returns the currently selected channel item. * @return */ selectedChannel(): AaiChannelItem; /** * Returns the currently selected definition. * @return */ selectedDefinition(): Aai20SchemaDefinition; deselectDefinition(): void; selectedOperationTrait(): AaiOperationTraitDefinition; selectedMessageTrait(): AaiMessageTraitDefinition; selectedMessage(): AaiMessage; preDocumentChange(): void; postDocumentChange(): void; /** * Called to get the current value in the editor. * @return */ getValue(): ApiDefinition; /** * Call this to select some content in the open document by the content's node path. If highlight * is true then the appropriate content section is also highlighted and scrolled into view. * @param path * @param highlight */ select(path: string, highlight?: boolean): void; /** * Called when the user clicks save. */ saveSource(): void; /** * Called when the user clicks revert. */ revertSource(): void; /** * Validates that the current source text is valid. */ validate(): void; getServerEditor(): ServerEditorComponent; getAaiServerEditor(): AaiServerEditorComponent; getSecuritySchemeEditor(): SecuritySchemeEditorComponent; getSecurityRequirementEditor(): SecurityRequirementEditorComponent; getDataTypeEditor(): DataTypeEditorComponent; getResponseEditor(): ResponseEditorComponent; getParameterEditor(): ParameterEditorComponent; getPropertyEditor(): PropertyEditorComponent; getOperationTraitEditor(): OperationTraitEditorComponent; getMessageTraitEditor(): MessageTraitEditorComponent; getMessageEditor(): MessageEditorComponent; getOneOfInMessageEditor(): OneOfInMessageEditorComponent; importComponent(type: ComponentType): void; } /** * Visitor used to determine what form should be displayed based on the selected node. */ export declare class FormSelectionVisitor extends CombinedVisitorAdapter { private version; _selectionType: string; _selectedNode: Node; constructor(version: string); selectionType(): string; formType(): string; selection(): Node; visitChannelItem(node: AaiChannelItem): void; visitSchemaDefinition(node: Aai20SchemaDefinition): void; visitOperationTraitDefinition(node: AaiOperationTraitDefinition): void; visitMessageTraitDefinition(node: AaiMessageTraitDefinition): void; visitMessage(node: AaiMessage): void; }